<template>
	<view class="container">
		<uni-list v-for="item,index in list" :key="index">
			<uni-badge :text="item.count">
				<uni-list-item :thumb="'/static/images/my_selected.png'" thumbSize="lg" :title="item.name"
					:note="item.type" :to="'../message/message?id='+item.id">

				</uni-list-item>
			</uni-badge>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"list": []
			}
		},
		methods: {
			onLoad() {
				uni.request({
					url: 'http://localhost:8090/freshmenapp/message/list',
					method: 'POST',
					data: this.list,
					success: res => {
						if (res.data.success) {
							this.list = res.data.list
							uni.showToast({
								title: '成功',
								icon: 'none'
							});
						} else {
							uni.showToast({
								title: '失败',
								icon: 'none'
							});
						}
					},
					fail: () => {
						uni.showToast({
							title: '网络错误',
							icon: 'none'
						});
					},
					complete: () => {}
				});
			},
		},
		onShow() {
			console.log("onShow");
		},
		onHide() {
			console.log('onHide');
		},
		onUnload() {
			console.log('onUnload');
		},
		onPullDownRefresh() {
			this.loadfood()
			uni.stopPullDownRefresh();
		},
		onLoad()  {
			this.loadfood()
		}
	}
</script>

<style>
	/deep/.uni-badge {
		position: absolute;
		bottom: 10px;
		right: 5px;
	}
</style>